

const Generator = require("yeoman-generator");

module.exports = class extends Generator {
    prompting(){
        return this.prompt([{
            type:"input",
            message:"your project name",
            name:"name"
        }]).then(answer=>{
            this.answer = answer
        })
    }

    writing(){
        // 获取所有模版
        const list = [
            "public/index.html",
            "README.md"
        ]

        list.forEach(item=>{
            const from = this.templatePath(item);
            const to = this.destinationPath(item);
            const context = this.answer;
            this.fs.copyTpl(from,to,context)
        })
    }
}